package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.entity.Train;
import com.qf.form.TrainForm;
import com.qf.mapper.TrainMapper;
import com.qf.service.TrainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class TrainServiceImpl implements TrainService {
    @Autowired
    private TrainMapper trainMapper;
    @Override
    public PageInfo<Train> selectAll(TrainForm form, Integer pageNum, Integer size) {
        PageHelper.startPage(pageNum,size);
        List<Train> trainList = trainMapper.list(form);
        PageInfo<Train> pageInfo =new PageInfo<>(trainList);
        return pageInfo;
    }
}
